<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <button class="btn">提交</button>
    <div class="box">
        <div class="left"></div>
        <div class="right"></div>
    </div>
</body>
</html>
<script src="js/get.js"></script>
<script src="js/request.js"></script>
<script>
    $('.btn').onclick=function(){
        request('/titleList?title=title&&name=热销','GET',null,function(dat){
            //对数据进行处理；
            dat=JSON.parse(dat);
           let {code,list,content}=dat;
           console.log(content)
           if(code===1){
              $('.left').innerHTML=list.map(item=>{
                   return `<p>${item}</p>`
               }).join('')//生成的了列表；
               //生成内容；
               $('.right').innerHTML=`<div class="pro">
                    <div class="pro-title">
                        <h4>${content[0].title}</h4>
                        <p>${content[0].subTitle}</p>
                    </div>
                    <div class="pro-list">
                        ${content[0].shopmenuFoods.map(item=>{
                            return `<div>
                                    <img src="${item.imgSrc}"/>
                                    <div>
                                        <p>${item.name}</p>
                                        <p>${item.mute}</p>
                                        <p>${item.price}</p>
                                    </div>
                                    <div class="btn-card">点击加入购物车</div>
                                </div>`
                        })}
                    </div>
                </div>`
           }
        })
    }
</script>